/**
 * Copyright @ 2013 - 2015 Suntec Software(Shanghai) Co., Ltd.
 * All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are NOT permitted except as agreed by
 * Suntec Software(Shanghai) Co., Ltd.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */

/**
 * @file Demo.h
 * @brief Declaration file of class Demo.
 *
 * This file includes the declaration of class Demo, and
 * the definitions of the macros.
 *
 * @attention used for C++ only.
 */


#ifndef DEMO_H
#define DEMO_H

#ifndef __cplusplus
#    error ERROR: This file requires C++ compilation (use a .cpp suffix)
#endif

#include "qmlframework/NQView.h"
#include <QVariant>

class NQRectangle;
class NQText;
class NQMouseEvent;

/**
 * @brief class Demo.
 *
 * This class is an example inherited from class NQVieww.
 *
 * @warning do something at the right time sequence.
 */
class Demo : public NQView
{
    Q_OBJECT

public:
    /// constructor.
    Demo(QQuickItem *parent = 0);

    /// destructor.
    ~Demo();

    /// overriden from class NQViewBase.
    void onCreate();

    /// overriden from class NQViewBase.
    void onPreActive();

    /// overriden from class NQViewBase.
    void onActive();

    /// overriden from class NQViewBase.
    void onPreDeactive();

    /// overriden from class NQViewBase.
    void onDeactive();

    /// overriden from class NQViewBase.
    void onDestroy();

    /// called from c++ or qml
    Q_INVOKABLE void onBtnClicked(QVariant event);

private:
    /// private member, a Rectangle item for view container.
    NQRectangle* m_container;

    /// private member, a Rectangle item for button.
    NQRectangle* m_btn;

    /// private member, a Text item for text.
    NQText* m_text;
};

#endif /* DEMO_H */
/* EOF */

